Skip to content

feat: resolve semver ranges in the version input - #459

Merged
jgoux merged 5 commits into
mainfrom
feat/version-semver-ranges
Nov 2, 2026
Merged

jgoux merged 5 commits into
mainfrom
feat/version-semver-ranges

Conversation

@jgoux

@jgoux jgoux commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The version input now accepts npm semver ranges and installs the highest published version that satisfies them:

- uses: supabase/setup-cli@v3
  with:
    version: ^2.95

Supported forms are the ones npm understands: caret (^2.95), tilde (~2.98.0), x-ranges (2.x, 2.98.*, 2), hyphen ranges (2.90.0 - 2.98.0), comparators (>=2.98 <2.99) and unions (^1 || ^2).

How it works

  • isVersionRange recognizes ranges by syntax, after the existing dist-tag, v<N>.stable and exact-version checks. Unknown words like canary or lastest still fail with the unsupported-version error instead of reaching npm as dist-tags.
  • A single npm view supabase@<range> version bin scripts dist.integrity deprecated dist-tags --json returns the matching manifests. The action picks one the way npm's installer does: latest when it matches and isn't deprecated, otherwise the highest non-deprecated match, otherwise the highest match. It logs Resolved Supabase CLI version "<range>" to <version>, then installs that exact verified version. The npm install and GitHub release fallback are unchanged.
  • When npm reports No match found for version, the action fails with No published Supabase CLI version matches "<range>". If npm cannot resolve the range, there is no GitHub release fallback because no exact version is known, which is the same behavior as dist-tags.
  • Prereleases follow npm's defaults, so ^2.95 never selects a beta unless the range names a prerelease.
  • Spaced operators (>= 2.98 < 2.99) and v/V prefixes in ranges are normalized before validation.
  • Every selector, dist-tags included, now installs the exact version whose metadata was verified, so the tag can't move between the check and the install.
  • Lockfile detection is unchanged.

Testing

  • bun run ci and bun run typecheck pass, including new integration tests for caret, x-range, comparator and single-match ranges, ranges with no match, npm failures, and rejected word-like inputs.
  • Ran the action locally against the npm registry: ~2.98.0 resolved to 2.98.2 and installed from npm, canary was rejected, and ^99 failed with the no-match error.
  • Added a ^2 entry to the e2e matrix.

CI flake fix

supabase start in e2e intermittently failed with failed to bind host port 0.0.0.0:54324: address already in use (5 failures on main since September, on 54322 and 54324). Supabase's local ports are inside Linux's ephemeral port range (32768-60999), so outbound connections during image pulls can hold one. The e2e job now reserves 54320-54329 with net.ipv4.ip_local_reserved_ports before anything runs.

Docs

  • Added an "Upgrading from v1 or v2" README section: v1 and v2 are legacy, @v3 can still install older CLI majors (version: ^2), and it notes the Node.js/npm requirement and the changed default version.

Accept npm semver ranges (^2.95, ~2.98.0, 2.x, >=2.98 <2.99, ^1 || ^2) and
install the highest published version that satisfies them. Ranges are
recognized by syntax so unknown words still fail, and npm resolves the
range to an exact version before the existing install and GitHub release
fallback run.
@jgoux jgoux self-assigned this Nov 2, 2026
@jgoux
jgoux requested a review from a team as a code owner November 2, 2026 12:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T12:38:23.845563Z af3fb72 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: beccaacca0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.ts Resolved

@avallete avallete left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, not sure we wanna handle the finding of codex, leave it up to you Julien to decide if that's a legitimate case.

jgoux added 3 commits November 2, 2026 13:34
Pick npm's latest when it satisfies the range, otherwise the highest
non-deprecated match, from a single npm view call, and install the exact
verified version. Accept spaced operators and v prefixes in ranges, and only
report a missing match when npm says no version matches.
Supabase's local ports fall inside Linux's ephemeral port range, so outbound
connections during image pulls could hold one when supabase start binds it,
failing with "address already in use" on ports like 54322 and 54324.
@jgoux
jgoux enabled auto-merge (squash) November 2, 2026 13:01
@jgoux
jgoux merged commit 30e7433 into main Nov 2, 2026
33 checks passed
@jgoux
jgoux deleted the feat/version-semver-ranges branch November 2, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants